<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../include/admincontent.jsp" %>
<div id="location">当前位置：首页 > 考官管理</div>
<div id="Content">
    <%--    <div class="btnbar">
            <button type="button" class="add" id="baseexaminer_add">添加考官</button>
            <button type="button" class="edit" id="baseexaminer_edit">修改考官</button>
            <button type="button" class="del" id="baseexaminer_del">删除考官</button>
            <button type="button" class="view" id="baseexaminer_view">查看考官</button>
        </div>--%>
    <div class="toolbars">
        <a id="baseexaminer_add">
            <em id="add_em" class="ico16 add_section_16"></em>
            <span id="send_span" class="menu_span" title="添加考官">添加考官</span>
        </a>
        <a id="baseexaminer_edit">
            <em  class="ico16 editor_16"></em>
            <span  class="menu_span" title="修改考官">修改考官</span>
        </a>
        <a id="baseexaminer_del">
            <em  class="ico16 del_16"></em>
            <span  class="menu_span" title="删除考官">删除考官</span>
        </a>
        <a id="baseexaminer_view">
            <em  class="ico16 preview_16"></em>
            <span  class="menu_span" title="查看考官">查看考官</span>
        </a>
    </div>
    <div id="searchbox">
        <form>
            <table class="treeTable searchform">
                <thead>
                <tr>
                    <td width="120">考官分组名称:</td>
                    <td width="200">
                        <div><input type="text" name="name"/></div>
                    </td>
                    <td width="120">
                        <%-- <button id="searchbtn" type="button" class="search"></button>--%>
                        <div class="toolbars">
                            <a id="baseexaminer_search" >
                                <em class="ico16 search_16"></em>
                                <span class="menu_span" title="查询">查询</span>
                            </a>
                        </div>
                    </td>
                    <td></td>
                </tr>
                </thead>
            </table>
        </form>
    </div>
    <%--    <table class="treeTable" id="tablelist">
            <thead>
            <tr>
                <td width="20"><input type="checkbox" class="allcheckbox" title="选择全部/取消全选"/></td>
                <td width="40">序号</td>
                <td>考官分组名称</td>
            </tr>
            </thead>
            <tbody id="result"></tbody>
        </table>
        <div id="page"></div>--%>

    <table class="layui-table" id="tableList" lay-filter="examIndexTable"></table>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        //添加考官
        $('#baseexaminer_add').click(function () {
            openLayer('添加考官信息', '/BaseExaminer/add', '98%', '98%');
        });

        //修改考官
        $('#baseexaminer_edit').click(function () {
            //EditInfo('修改考官信息', '/BaseExaminer/edit?_x=2015', '98%', '98%');
            var url = '/BaseExaminer/edit?_x=2015';

            var id = '';
            var checkRows = layui.table.checkStatus('examIndexTable').data;
            var count = checkRows.length;

            if (count < 1) {
                //$.Showmsg('请选择一条信息');
                layer.msg('请选择一条信息',{icon:7,time:2000});
            } else if (count > 1) {
                //$.Showmsg('只能选择一条信息');
                layer.msg('只能选择一条信息',{icon:7,time:2000});
            } else {
                $(checkRows).each(function (index, itme) {
                    id = itme.ids.replace('cb_', '');
                });
                openLayer('修改考官信息', url + '&id=' + id, '98%', '98%');
            }
        });
        //删除考官
        $('#baseexaminer_del').click(function () {
            var checkRows = layui.table.checkStatus('examIndexTable').data;
            var id = '';
            var count = checkRows.length;

            if (count < 1) {
                layer.msg('请选择一条信息',{icon:7,time:2000});
            } else if (count > 1) {
                layer.msg('只能选择一条信息',{icon:7,time:2000});
            } else {
                $(checkRows).each(function (index, itme) {
                    id = itme.ids.replace('cb_', '');
                });
                $.post("/BaseExaminer/DelAction", {id: id}, function (result) {
                    if (result.state) {
                        layer.alert(result.Message, {icon: 1});
                        //getList();
                        tavkeIns.reload('examIndexTable', {
                            page: {
                                curr: 1
                            }
                        });
                    } else {
                        layer.alert(result.Message, {icon: 2});
                    }
                }, "JSON");
            }
        });
        //查看考官
        $('#baseexaminer_view').click(function () {
            // EditInfo('查看考官信息', '/BaseExaminer/view?_x=2015', '800px', '600px');
            var url = '/BaseExaminer/view?_x=2015';

            var id = '';
            var checkRows = layui.table.checkStatus('examIndexTable').data;
            var count = checkRows.length;

            if (count < 1) {
                //$.Showmsg('请选择一条信息');
                layer.msg('请选择一条信息',{icon:7,time:2000});
            } else if (count > 1) {
                //$.Showmsg('只能选择一条信息');
                layer.msg('只能选择一条信息',{icon:7,time:2000});
            } else {
                $(checkRows).each(function (index, itme) {
                    id = itme.ids.replace('cb_', '');
                });
                openLayer('查看考官信息', url + '&id=' + id, '98%', '98%');
            }
        });

    });

    var tavkeIns;
    let layuithis;
    layui.use('table',function () {
        var table = layui.table;
        layuithis = this;

        tavkeIns = table.render({
            id:'examIndexTable',
            elem:'#tableList',
            url: '/BaseExaminer/getJsonExamlists',
            title:'数据表',
            height:'full',
            cols:[[
                {type:'checkbox',fixed:'left'},
                {field:'id',title:'ID',fixed:'left',sort:true,width:180},
                {field: 'name',title: '考官分组名称',fixed: 'left',sort: true}
            ]],
            page:true
        });
    });

    $("#baseexaminer_search").on('click', function () {

            function fun1() {
                layui.use('table', () => {

                        tavkeIns.reload({
                            url: "/BaseExaminer/getJsonExamlists",
                            where: {
                                name: $("input[name='name']").val()
                            },
                            page: {
                                curr: 1
                            }
                        });
                    }
                );
            }

            fun1.call(layuithis)
        }
    );


    /*    function getList() {
            var url = '/BaseExaminer/getlists';
            $("#page").myPagination({
                cssStyle: "pagination",
                ajax: {
                    on: true,
                    url: url,
                    param: $("form").serialize(),
                    dataType: 'html',
                    callback: function (data) {
                        $("#result").html(data);
                    }
                }
            });
        }*/
</script>
</body>
</html>